package cn.efunbox.afw.data.jpa.service.support;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import cn.efunbox.afw.data.jpa.spring.support.AfwJpaRepository;

import java.io.Serializable;
import java.util.List;

public class BaseServiceImpl<E, ID extends Serializable> implements BaseService<E, ID> {


	@Autowired
	private AfwJpaRepository<E, ID> afwJpaRepository;

   /* public BaseServiceImpl(AfwJpaRepository<E, ID> afwJpaRepository) {
		this.afwJpaRepository = afwJpaRepository;
	}*/

	@Override
	public long count(E sample) {
		return afwJpaRepository.count(sample);
	}

	@Override
	public boolean exists(E sample) {
		return afwJpaRepository.exists(sample);
	}

	@Override
	public E find(ID id) {
		return afwJpaRepository.find(id);
	}

	@Override
	public E findFirst(E sample) {
		return afwJpaRepository.findFirst(sample);
	}

	@Override
	public E findFirst(E sample, Sort sort) {
		return afwJpaRepository.findFirst(sample, sort);
	}

	@Override
	public List<E> find(Long start, Integer offset) {
		return afwJpaRepository.find(start,offset);
	}

	@Override
	public List<E> find(Long start, Integer offset, Sort sort) {
		return afwJpaRepository.find(start,offset,sort);
	}

	@Override
	public List<E> find(E sample) {
		return afwJpaRepository.find(sample);
	}

	@Override
	public List<E> find(E sample, Sort sort) {
		return afwJpaRepository.find(sample,sort);
	}

	@Override
	public List<E> find(E sample, Long start, Integer offset) {
		return afwJpaRepository.find(sample,start,offset);
	}

	@Override
	public List<E> find(E sample, Long start, Integer offset, Sort sort) {
		return afwJpaRepository.find(sample,start,offset,sort);
	}

	@Override
	public E update(E entity) {
		return afwJpaRepository.update(entity);
	}

	@Override
	public E update(E entity, boolean ignoreNull) {
		return afwJpaRepository.update(entity,ignoreNull);
	}
}